package LinkList;

public class Test {
    public static void main(String[] args) {
        Chain chain1 = new Chain();
        Chain chain2 = new Chain();
        Chain chain3 = new Chain();
        // 按降幂实例化链表
        chain1.addAt(0, new Item(1, 5));
        chain1.addAt(1, new Item(-2, 3));
        chain1.addAt(2, new Item(1, 1));
        chain2.addAt(0, new Item(1, 5));
        chain2.addAt(1, new Item(2, 4));
        chain2.addAt(2, new Item(3, 3));

        chain3 = chain3.mergeChain(chain1, chain2);

        System.out.println("链表实现一元多项式的相加减过程: ");
        chain1.chainAll();
        System.out.print(" + ");
        chain2.chainAll();
        System.out.print(" = ");
        chain3.chainAll();
    }
}
